<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
		<script type="text/javascript" src="js/Utils.js"></script>
		<script type="text/javascript" src="js/jquery-2.1.0.js"></script>
		<script type="text/javascript">
			function safePassword(value, voc) {
				//var re = new RegExp("^((\d*|[-_\~!@#\$%\^&\*\.\(\)\[\]\{\}<>\?\\\/\'\"]*)|.{0," + (voc - 1) + "})$");
				var re = new RegExp("(\\d)+");
				console.log(value);
				//				return !re.test(value) && /^\S+$/gi.test(value); //验证空格不存在/^\S+$/gi.test(value)
				return re.test(value);
			}

			$(function() {
				$('#sub').click(function() {
					var userName = $('#userName').val();
					var userPassword = $("#userPassword").val();
					var childUser = new ChildUser("", userName, userPassword);

					var childUser2Str = "{'userId':'12','userName':'sfb','userPasswrod':'xyg123'}"
					var childUser2 = JSON.parse(childUser2Str);

					if(childUser.checkUser()) {
						alert("用户名或者密码不能为空");
					} else {
						alert(childUser.toString());
					}
				});

				$("#jy").click(function() {
					//					var par = "^[A-Za-z][A-Za-z0-9]{2,13}$";
					//					var re = new RegExp(par);
					//					alert(safePassword($("#strValue").val(),3));

					var userName = $('#userName').val();
					var userPassword = $("#userPassword").val();
					var childUser = new ChildUser("", userName, userPassword);

					var childUser2Str = '{"userId":"12","userName":"sfb","userPasswrod":"xyg123"}';
					var childUser2 = JSON.parse(childUser2Str);
					console.log(childUser instanceof ChildUser);
					console.log(childUser2);
				})

			});
		</script>
	</head>

	<body>

		<label for="userName">用户名：</label><input type="text" name="userName" id="userName" value="" />
		<label for="userName">密码：</label><input type="password" name="userPassword" id="userPassword" value="" />
		<input type="button" id="sub" value="确定" />

		<input type="text" id="strValue" value="" />
		<input type="button" value="校验" id="jy" />

	</body>

</html>